package de.szut.entity;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;
import de.szut.impl.PointsDaoImpl;
import de.szut.util.PointIncreaseType;

import java.io.Serializable;

/**
 * Created with IntelliJ IDEA.
 * User: dzebcuks
 * Date: 11.10.13
 * Time: 09:14
 * To change this template use File | Settings | File Templates.
 */
@DatabaseTable(daoClass = PointsDaoImpl.class)
public class Points implements Serializable {

    @DatabaseField(generatedId = true)
    private int id;

    @DatabaseField
    private Integer value = new Integer(0);

    @DatabaseField
    private String user;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getUser() {
        return user;
    }

    public void increaseValue(int pointsToAdd){
        this.value += pointsToAdd;
    }

    public void decreaseValue(int pointsToRemove){
        this.value -= pointsToRemove;
    }

    public void increaseValueByType(PointIncreaseType type){
        this.increaseValue(type.getPointBonus());
    }

    public void setUser(String user) {
        this.user = user;
    }

    public Integer getValue() {
        return value;
    }

    public void setValue(Integer value) {
        this.value = value;
    }


}
